<template>
    <div class="share-content base-padding white-back" v-if="contentList.length>0" @click="goTogether">
      <p class="group-comment" >{{contentList[0]}}</p>
      <div class="content-back">
        <div class="post-thumb"><img v-lazy="pic" /></div>
        <div class="post-content v-c"><p class="two-line">{{contentList[1]}}</p></div>
      </div>
    </div>
</template>

<script>
import api from "src/api/index";
export default {
  name: 'groupitem',
  components: {api},
  props: {
    pic: {
      type: String,
      defalut:""
    },
    commenttext: {
      type: String,
      defalut: ""
    },
  },

  data() {
    return{
      contentList:[],//评论+邀请文案+拼团id
    }
  },

  watch: {},

  created() {
    this.init()
  },

  mounted() {},

  destroyed() {},

  methods: {
    init(){
      this.contentList = this.commenttext.split("://?")
    },
    goTogether(){
      const params ={togetherId:this.contentList[2]}
      api.goTogether(params).then(res=>{
        if(res.code==0){
          console.log(res.data);
           window.location.href=res.data; 
        }
      })
    }
  }

}
</script>

<style lang="less" scoped>

.share-content{
  margin: 0 0.2rem;
  .group-comment{
    padding: 0.15rem 0;
    width: 7.1rem;
  }
  .post-thumb {
    float: left;
    img{
      display: block;
      width: 1.2rem;
      margin: 0.1rem;
      height:1.2rem;
    }
  }
  .post-content{
    height: 1.4rem;
    padding-left:0.18rem;
    width: 5.6rem;
  }
  .content-back{
    background:#f0f0f0;
  }
}

</style>

